from presenter.ticket import TicketPresenter


class OrderPresenter:
    def __init__(self, data):
        self.data = data

    def as_dict(self):
        return {
            "id": self.data.id,
            "orderNo": self.data.order_no,
            "price": self.data.price,
            "state": self.data.state,
            "paymentTime": self.data.payment_time,
            "tickets": [TicketPresenter(ticket).as_dict() for ticket in self.data.tickets]
        }
